package com.gec.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gec.model.pojo.TComment;
import com.gec.model.vo.TCommentQueryVo;
import com.gec.system.Service.TCommentService;
import com.gec.system.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "前台评论管理控制器")
@RestController
@RequestMapping("/admin/system/tComment")
public class TCommentController {

    @Autowired
    private TCommentService tCommentService;

    @ApiOperation("分页和条件查询")
    @GetMapping("/{page}/{limit}")
    public Result selectTCommentPageByVo(@PathVariable Long page,
                                         @PathVariable Long limit,
                                         TCommentQueryVo tCommentQueryVo) {
        IPage<TComment> iPage = new Page<>(page,limit);
        iPage = tCommentService.selectPage(iPage,tCommentQueryVo);
        return Result.ok(iPage);
    }
}
